package com.service;


import com.dao.SortDao;
import com.entity.Dto;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by asus on 2017-02-08.
 */
public class SortService {
    private SortDao sortDao = new SortDao();
    public List<Dto> LoadAllGoods(int page, int displayCount){
        List<Dto> Goodss = null;
        try {
            Goodss=sortDao.LoadAll(page,displayCount);
        }catch (SQLException e){
            e.printStackTrace();
        }
        System.out.println("Service层是否为空"+Goodss.size());
        return Goodss;
    }
    public int displayPage(int displayCount){
        int maxpage=0;
        int count;
        try {
            count=sortDao.getCount();
            maxpage=count%displayCount==0 ? count/displayCount : count/displayCount+1;
        }catch (SQLException e){
            e.printStackTrace();
        }
        return maxpage;
    }
}
